displayed.</para>
<para>The "color" option allows you to specify the color for
line or mapnote data. It accepts color names of the form "#FF0000" (red) or any
-of the 16 common color names from the Cascading Style Sheets
+of the color names from the Cascading Style Sheets (CSS)
specification.i</para>
<para>The "wpt_type" option specifies how to represent point data
in the draw file. Valid waypoint types are "marker", "text", "mapnote",
Note that if your goal is to create an arc or other CSV file, you
should use 'none' (or not use this option, which is the same
thing.)</para>
+ <para>The 'times' option causes GPSBabel to read the route as if
+it were a track, synthesizing times starting from the current time, using
+the estimated travel times specified in your route file (you can change your
+travel speeds in the DeLorme product you used to create the route file.)</para>
<para> All options only apply to route files from newer (anr)
versions of DeLorme software; older versions didn't store the turn
information with the route.
#define MYNAME "saroute"
#include "defs.h"
+#include "grtcirc.h"
FILE *infile;
char *turns_only = NULL;
char *controls = NULL;
char *split = NULL;
+char *times = NULL;
int control = 0;
NULL, ARGTYPE_BOOL, ARG_NOMINMAX },
{"controls", &controls, "Read control points as waypoint/route/none",
"none", ARGTYPE_STRING, ARG_NOMINMAX },
+ {"times", ×, "Synthesize track times",
+ NULL, ARGTYPE_BOOL, ARG_NOMINMAX },
ARG_TERMINATOR
};
route_head *old_track_head = NULL;
waypoint *wpt_tmp;
char *routename = NULL;
+ double seglen = 0.0;
+ long starttime = 0;
+ long transittime = 0;
+ double totaldist = 0.0;
+ double oldlat = 0;
+ double oldlon = 0;
+ int first = 0;
ReadShort(infile); /* magic */
version = ReadShort(infile);
*/
if ( version < 6 || (control == 1)) {
track_head = route_head_alloc();
- route_add_head(track_head);
+ if ( times ) {
+ track_add_head(track_head);
+ }
+ else {
+ route_add_head(track_head);
+ }
if ( control ) {
track_head->rte_name = xstrdup("control points");
}
count = ReadLong(infile);
if ( count ) {
track_head = route_head_alloc();
- route_add_head(track_head);
+ if ( times ) {
+ track_add_head(track_head);
+ }
+ else {
+ route_add_head(track_head);
+ }
if ( routename && !split ) {
track_head->rte_name = xstrdup( routename );
}
if ( track_head->rte_waypt_ct ) {
old_track_head = track_head;
track_head = route_head_alloc();
- route_add_head( track_head );
+ if ( times ) {
+ track_add_head( track_head );
+ }
+ else {
+ route_add_head( track_head );
+ }
} // end if
if ( !track_head->rte_name ) {
track_head->rte_name =
track_head->rte_name[stringlen] = '\0';
}
}
+
+ if ( times ) {
+ le_read64( &seglen,
+ record + 2 + stringlen + 0x08 );
+ starttime = le_read32((unsigned long *)
+ (record + 2 + stringlen + 0x30 ));
+ transittime = le_read32((unsigned long *)
+ (record + 2 + stringlen + 0x10 ));
+ seglen /= 5280*12*2.54/100000; /* to miles */
+ }
coordcount = le_read16((unsigned short *)
(record + 2 + stringlen + 0x3c));
if (count) {
coordcount--;
}
+
+ first = 1;
+
while (coordcount) {
double lat;
double lon;
sprintf( wpt_tmp->shortname, "\\%5.5x",
serial++ );
}
+ if ( times ) {
+ if ( !first ) {
+ double dist = tomiles(gcdist(
+ lat*M_PI/180, -lon*M_PI/180,
+ oldlat*M_PI/180,
+ -oldlon*M_PI/180 ));
+ totaldist += dist;
+ if ( totaldist > seglen ) {
+ totaldist = seglen;
+ }
+ wpt_tmp->creation_time =
+ gpsbabel_time+starttime+
+ transittime * totaldist/seglen;
+ }
+ else {
+ wpt_tmp->creation_time =
+ gpsbabel_time+starttime;
+ totaldist = 0;
+ }
+ oldlat = lat;
+ oldlon = lon;
+ }
if ( turns_important && stringlen )
wpt_tmp->route_priority=1;
if ( !turns_only || stringlen ) {
old_track_head = NULL;
}
}
-
latlon++;
coordcount--;
if ( coordcount == 1 && count == 0 ) {
stringlen = 1;
}
+ first = 0;
}
if ( version > 10 ) {
Skip(infile,2*sizeof(gbuint32));